﻿using Grpc.Net.Client;
using GrpcService1;

namespace ClientGRPC
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string url = "https://localhost:5001";   //https
            using (var channel = GrpcChannel.ForAddress(url))
            {
                var client = new Greeter.GreeterClient(channel);
                var reply = client.SayHello(new HelloRequest()
                {
                    Name = "故里2130"
                });

                Console.WriteLine($"结果:message:{reply.Message}");
            }
            Console.ReadKey();


            //AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);  //http调用
            //string url = "http://localhost:5000";

            //using (var channel = GrpcChannel.ForAddress(url))
            //{
            //    var client = new Greeter.GreeterClient(channel);
            //    var reply = client.SayHello(new HelloRequest()
            //    {
            //        Name = "故里2130"
            //    });

            //    Console.WriteLine($"结果:message:{reply.Message}");
            //}
            //Console.ReadKey();
        }
    }
}